﻿using Data.MongoDb.Core;
using MongoDB.Driver;
using MongoDB;
namespace Data.MongoDb
{
    public class MongoBase
    {
        protected IMongoDatabase Init()
        {
            if (MongoSetting.Current == null)
            {
                throw new MongoException("No mongo setting info is provided.");
            }
            var client = new MongoClient(MongoSetting.Current.ConnectionString);
            var db = client.GetDatabase(MongoSetting.Current.DatabaseName);
            return db;
        }
    }
}
